import http from "@/common/http";
import loginLogResponse from './mock/loginLog.json'
import optLogResponse from './mock/optLog.json'

export function apiGetLoginLogList(params: any, useMock?: boolean): Promise<any> {
  if (useMock) {
    return Promise.resolve(loginLogResponse)
  }
  return http.get('/gateway/ums/sys-role', params)
}

export function apiGetOperateLogList(params: any, useMock?: boolean): Promise<any> {
  if (useMock) {
    return Promise.resolve(optLogResponse)
  }
  return http.get('/gateway/ums/sys-role', params)
}

export function apiGetSystemLogList(params: any, useMock?: boolean): Promise<any> {
  if (useMock) {
    return Promise.resolve(optLogResponse)
  }
  return http.get('/gateway/ums/sys-role', params)
}

export async function removeLoginLog(ids: number[], useMock?: boolean) {
  if (useMock) {
    return Promise.resolve(optLogResponse)
  }
  return http.delete('/api/sys/loginLog/delete', {data: ids})
}

export async function queryLoginLog(params?: any) {
  return http('/api/sys/loginLog/list', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function removeLoginLogOne(params: { id: number }) {
  return http('/api/sys/loginLog/delete', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function querySysLog(params?: any) {
  return http('/api/sys/sysLog/list', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function removeSysLogOne(params: { id: number }) {
  return http('/api/sys/sysLog/delete', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function removeSysLog(params: { ids: number[] }) {
  return http('/api/sys/sysLog/delete', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
